package com.faceCaptor.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;


public class JsonUtil {
	
	public static JSONObject toJsonObject(String str,String key){
		JSONObject dataObject = null;
		if(str!=""){
			JSONObject data = JSON.parseObject(str);
			
			if(data.containsKey(key)){
				dataObject = data.getJSONObject(key);
			}
		}
		
		
		
		return dataObject;
	}
	
	public static JSONArray toJsonArray(String str,String key){
		JSONArray arr = null;
		if(str!=""){
			JSONObject data = JSON.parseObject(str);
			
			if(data.containsKey(key)){
				arr = data.getJSONArray(key);
			}
		}
		
		
		
		return arr;
	}

}
